<template>
  <div class="container">
    <div class="icon-box flex-box">
      <div class="icon-box-main flex-box">
        <img src="@/assets/img/icon-success.png">
        <p v-if="pageType==2">修改密码成功</p>
        <p v-else>注册成功</p>
      </div>
    </div>
    <div class="commit-btn">
      <button @click="toLogin">返回登录页</button>
    </div>
  </div>
</template>

<script>
// @ is an alias to /src

export default {
  name: 'home',
  data() {
    return {
      list: '',
      pageType: 1
    }
  },
  components: {},
  computed: {},
  methods: {
    toHome() {
      this.$router.replace('/')
    },
    toLogin() {
      if (this.pageType === 2) {
        this.$router.replace({ path: '/login', query: { redirect: '/mine' } })
      } else {
        this.$router.replace({ path: '/login', query: { redirect: '/' } })
      }
    }
  },
  created() {
    if (this.$route.query.type) {
      this.pageType = this.$route.query.type
    }
  },
  mounted() {
    // console.log(this.$route)
  }
}
</script>
<style lang="scss">
.container {
  width: 100%;
  height: 100%;
  background: #f3f8fb;
  .icon-box {
    width: 100%;
    height: 240px;
    .icon-box-main {
      flex-wrap: wrap;
      -webkit-flex-wrap: wrap;
      img {
        width: 100px;
      }
      p {
        width: 100%;
        margin-top: 8px;
        font-size: 22px;
        color: #000000;
        line-height: 30px;
      }
    }
  }
  .commit-btn {
    width: 100%;
    padding: 0 20px;
    box-sizing: border-box;
    button {
      width: 100%;
      height: 42px;
      font-size: 16px;
      color: #fff;
      background: #1c93d0;
      font-weight: bold;
      border: none;
      margin-top: 20px;
      border-radius: 5px;
      &:disabled {
        opacity: 0.5 !important;
      }
    }
  }
}
</style>
